import request from '@/utils/request'

// 创建物料分类
export function createMaterialCategory(data) {
  return request({
    url: '/basic/material-category/create',
    method: 'post',
    data: data
  })
}

// 更新物料分类
export function updateMaterialCategory(data) {
  return request({
    url: '/basic/material-category/update',
    method: 'put',
    data: data
  })
}

// 删除物料分类
export function deleteMaterialCategory(id) {
  return request({
    url: '/basic/material-category/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除物料分类 */
export function deleteMaterialCategoryList(ids) {
  return request({
    url: `/basic/material-category/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得物料分类
export function getMaterialCategory(id) {
  return request({
    url: '/basic/material-category/get?id=' + id,
    method: 'get'
  })
}

// 获得物料分类分页
export function getMaterialCategoryPage(params) {
  return request({
    url: '/basic/material-category/list',
    method: 'get',
    params
  })
}

// 导出物料分类 Excel
export function exportMaterialCategoryExcel(params) {
  return request({
    url: '/basic/material-category/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}
